﻿//创建时间: 2010-12-15
//创建作者: 李 城
//功能说明: cms外部页面访问基类 评论列表
//最后修改: 2010-12-15
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using TRPOP.CMS.Business;
using TRPOP.CMS.Model;
using System.Web;

using TRPOP.Config;
using TRPOP.Common;

namespace TRPOP.CMS.Web.ExtraBus
{
    /// <summary>
    /// 评论列表
    /// </summary>
    public class Page_Load_RecommentList : BasePage
    {
        protected override void OnInit(EventArgs e)
        {
            string strRecommentListUrl = SYSConfig.RecommentListUrl.Remove(SYSConfig.RecCountPage.IndexOf("?"));
            string strDynamicPageName = 
                (base.mCurrentUrl.ToLower().Contains(strRecommentListUrl.ToLower().Trim())) ? "RecommentListUrl" : "";
            if (strDynamicPageName == "RecommentListUrl")
                Rec_List();
            else
                Base_Config.NotFound(base.Page, "CMS后台配置的页面地址和访问的页面不一致(评论)");
            //base.OnInit(e);
        }
        /// <summary>
        /// 解析评论页面
        /// </summary>
        public void Rec_List()
        {
            int o_intContentId = 0;
            int o_intPageindex = 0;
            o_intContentId = RequestHelper.RequestInt("id");
            if (o_intContentId <= 0)
                o_intContentId = RequestHelper.RequestInt("indexid");
            o_intPageindex = RequestHelper.RequestInt("page");
            o_intPageindex = o_intPageindex <= 0 ? 1 : o_intPageindex;
            TRPOP.CMS.Model.ContentInfo oContentInfo = new TRPOP.CMS.Model.ContentInfo();
            oContentInfo = (new ContentManage()).GetInfoById(o_intContentId);
            if (oContentInfo == null)
            {
                //Response.Write(o_intContentId.ToString());
                Base_Config.NotFound(base.Page, "内容信息不存在");
            }
            object obj = TRPOP.CMS.Publish.PublishAccess.GetOneContentRecPage(oContentInfo, o_intPageindex);
            if (obj is string &&  !obj.ToString().IsEmpty())
            {
                Response.Clear();
                Response.ClearHeaders();
                Response.ClearContent();
                Response.Write(obj.ToString());
                Response.End();
            }
            else
                Base_Config.NotFound(base.Page, "评论信息不存在或模板解析不正常");
        }
    }
}
